/*

package com.deer.wms.base.system.webservice.client;

*/
/**
 * Please modify this class to meet your needs
 * This class is not complete
 *//*


import cn.hutool.core.date.DateUtil;
import com.deer.wms.base.system.dao.bill.BillInSapMapper;
import com.deer.wms.base.system.model.bill.BillInSap;
import com.deer.wms.base.system.model.bill.BillInSapDetail;
import com.deer.wms.base.system.service.bill.BillInSapDetailService;
import com.deer.wms.base.system.web.billsend.MM101Send;
import com.deer.wms.base.system.web.billsend.MM101_ZDATA_MKPF;
import com.deer.wms.base.system.web.billsend.MM101_ZDATA_MSEG;
import com.deer.wms.base.system.webservice.model.saprequest.ConstantTrans;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.namespace.QName;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

*/
/**
 * This class was generated by Apache CXF 3.2.4
 * 2021-06-22T08:28:02.439+08:00
 * Generated source version: 3.2.4
 *//*

@Service
@Slf4j
public final class SAPTOW1071HBWMSREQUEST_SAPWebServiceImplPort_Client implements Job {
    @Autowired
    BillInSapDetailService billInSapDetailService;

    private static final QName SERVICE_NAME = new QName("uri:com.tjsemi.wms", "SAP_TO_W1071HBWMS_REQUEST");

    @Autowired
    ClientSAPTOW1071HBWMSREQUEST_Service ss ;

    @Autowired
    ClientSAPTOW1071HBWMSREQUEST port ;

    @Autowired
    BillInSapMapper billInSapMapper;

    @Autowired
    ClientTOWMSREQ _sapTOW1071HBWMSREQUEST_clientTOWMSREQ;

    private SAPTOW1071HBWMSREQUEST_SAPWebServiceImplPort_Client() {
    }

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        // 查询DB或者Redis判断是否需要自动过账
        List<BillInSapDetail> billInOkSendToSAPList = billInSapDetailService.billInOkSendToSAP();
        if(billInOkSendToSAPList == null){
            // 不存在需要过账的单据，直接返回
            return;
        }
        List<MM101Send> ZDATA_List = new ArrayList<>();
        for (BillInSapDetail sapDto : billInOkSendToSAPList) {
            String now = DateUtil.now();
            MM101Send modelZdata = new MM101Send();

            MM101_ZDATA_MKPF mkpf = new MM101_ZDATA_MKPF();
            mkpf.setWMSHN(sapDto.getVBELN()); // WMS单号
            mkpf.setBLDAT(now);// 凭证日期
            mkpf.setBUDAT(now);// 过账日期
            mkpf.setBWART(ConstantTrans.EL);// 移动类型
            modelZdata.setMKPF(mkpf);

            MM101_ZDATA_MSEG mesg = new MM101_ZDATA_MSEG();
            // todo 下面4行需要进一步明确
            mesg.setWMSHN(sapDto.getVBELN());
            mesg.setWMSIN(sapDto.getPOSNR());
            mesg.setVBELN_IM(sapDto.getVBELN());
            mesg.setVBELP_IM(sapDto.getPOSNR());
            mesg.setWERKS(sapDto.getWERKS());
            mesg.setLGORT(sapDto.getLGORT());
            mesg.setERFMG(String.valueOf(sapDto.getLGMNG()));
            mesg.setERFME(sapDto.getMEINS());
            mesg.setCHARG(sapDto.getCHARG());
            modelZdata.setMSEG(mesg);
            ZDATA_List.add(modelZdata);
        }
        URL wsdlURL = ClientSAPTOW1071HBWMSREQUEST_Service.WSDL_LOCATION;
        ClientSAPTOW1071HBWMSREQUEST_Service ss = new ClientSAPTOW1071HBWMSREQUEST_Service(wsdlURL, SERVICE_NAME);
        ClientSAPTOW1071HBWMSREQUEST port = ss.getSAPWebServiceImplPort();
        log.info("Invoking sapTOW1071HBWMSREQUEST...");
        ClientTOWMSREQ clientTOWMSREQ = new ClientTOWMSREQ();
        clientTOWMSREQ.setBSKEY("clientReturn");
        ClientTOWMSRESP sapBackResult = port.sapTOW1071HBWMSREQUEST(clientTOWMSREQ);
        System.out.println("sapTOW1071HBWMSREQUEST.result=" + sapBackResult.getBSKEY());
        */
/*String result= _sapTOW1071HBWMSREQUEST__return.getBSKEY();
        String s1=_sapTOW1071HBWMSREQUEST__return.getSAPKEY();
        String s2=_sapTOW1071HBWMSREQUEST__return.getBSKEY();
        String s3=_sapTOW1071HBWMSREQUEST__return.getZDATA();
        String s4=_sapTOW1071HBWMSREQUEST__return.getZMESSAGE();
        String s5=_sapTOW1071HBWMSREQUEST__return.getZTYPE();
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
        System.out.println(s4);
        System.out.println(s5);*//*

        */
/*String[] split = s3.split(",");
        String[] split1 = split[1].split(":");//单号
        String[] split2 = split[2].split(":");//行号
        //String[] split3 = split[3].split(":");//状态*//*


        //返回值为正常时更新数据状态为已过帐
        if(sapBackResult.getZTYPE().equals("正常")){
            BillInSapDetail billInSapDetail=new BillInSapDetail();
            billInSapDetail.setVBELN(sapBackResult.getWmshn());
            billInSapDetail.setPOSNR(sapBackResult.getWmsin());
            billInSapDetailService.updateCarryState(billInSapDetail);
            BillInSap billInSap=new BillInSap();
            billInSap.setVBELN(sapBackResult.getWmshn());
            billInSapMapper.updatestate(billInSap);

        }


        System.out.println("启动成功");

        System.out.println(sapBackResult);


    }


}
*/
